package com.jumi.microservice.material.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.jumi.microservice.common.base.BaseController;
import com.jumi.microservice.common.base.dto.ResponseResult;
import com.jumi.microservice.common.constant.RequestConstant;
import com.jumi.microservice.material.service.ExcelService;
import com.jumi.microservice.material.service.GoodsTaxService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;

/**
 * <p>
 * 商品税务 前端控制器
 * </p>
 *
 * @author ZhangY
 */
@RestController
@RequestMapping("/goodsTax")
@CrossOrigin
@Slf4j
@Api(tags = {"【基础资料】商品税务接口"})
public class JmGoodsTaxController extends BaseController
{

	@Autowired
	private GoodsTaxService goodsTaxService;

	@Autowired
	private ExcelService excelService;

	/**
	 * 全查
	 */
	@ApiOperation("查询所有商品税务信息")
	@GetMapping("/findAllGoodsTaxs")
	public ResponseResult search()
	{
		return ResponseResult.success(goodsTaxService.findAll());
	}


	/**
	 * @Description: Excel批量导入税务信息  -- EasyExcel
	 */
	//@ApiOperation("Excel批量导入属性")
	//@PostMapping("/importGoodsTaxs")
	//@Log(title = "供应链管理-基础管理-物料属性",businessType = BusinessType.INSERT)
	public ResponseResult importGoodsTaxsExcel(HttpServletRequest request, @RequestHeader(RequestConstant.ADMIN_NAME) String createBy)
	{
		Long uid = getUid();
		return excelService.excelGoodsTaxsImport(request,uid,createBy);
	}

}
